package com.epro.dx.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

/**
 * 动态注册解锁和锁屏广播的服务
 * @author Zenglw
 * @version 1.0
 * @date 2017/7/7
 * @see [相关类]
 */

public class SurvivalService extends Service {
    private static final String TAG = "SurvivalService";
    private ScreenBroadListener screenBroadListener;

    public SurvivalService() {
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.e(TAG, "onStartCommand: ");
        screenBroadListener = new ScreenBroadListener(this);
        screenBroadListener.registerBroadCast();
        return Service.START_STICKY;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.e(TAG, "onDestroy: "+ "进程死亡");
        screenBroadListener.unRegisterBroadCast();
    }
}
